package com.shqcjd.preinstallmobile.ui.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.preinstallmobile.R;
import com.shqcjd.preinstallmobile.model.pojo.MenuEntity;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 菜单
 * Created by sy on 2019/3/15.
 */

public class MenuAdapter extends BaseQuickAdapter<MenuEntity,MenuAdapter.ViewHolder> {


    public MenuAdapter(@Nullable List<MenuEntity> data) {
        super(R.layout.item_menu_layout, data);
    }

    @Override
    protected void convert(ViewHolder helper, MenuEntity item) {
        int url = -1;
        switch (item.name) {
            case "巡检系统":
                url = R.mipmap.xjxt;
                break;
            case "缺陷管理":
                url = R.mipmap.qxgl;
                break;
            case "远程指导":
                url = R.mipmap.yczd;
                break;
            case "图像回放":
                url = R.mipmap.txhf;
                break;
            case "设备管理":
                url = R.mipmap.sbgl;
                break;
        }
        Glide.with(mContext)
                .load(url)
                .into(helper.iv_logo);

        helper.tv_name.setText(item.name);
    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.iv_logo)
        ImageView iv_logo;
        @BindView(R.id.tv_name)
        TextView tv_name;
        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
